package com.imooc.pan.feignservice;

import com.imooc.pan.core.response.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * @author Janson
 * @Description 远程调用熔断接口
 * @Date 2023/8/5
 */
@Slf4j
@Component
public class UserStorageSizeServiceFallbackFactory implements FallbackFactory<UserStorageSizeServiceClient> {
    @Override
    public UserStorageSizeServiceClient create(Throwable cause) {
        return new UserStorageSizeServiceClient() {
    
            @Override
            public R updateUserStorage(BigDecimal businessSize, Integer duration) {
                log.error("远程调用上传文件的接口发生熔断:{}",cause.toString(),cause);
                return null;
            }
        };
    }
}
